package me.thinkjet.controller;

import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.kit.FileKit;
import me.thinkjet.service.UploadService;

import java.io.File;

/**
 * 图片处理类
 */
@ControllerBind(controllerKey = "/image", viewPath = "/")
public class ImageController extends Controller {

    /**
     * 上传图片
     */
    public void upload() {
        System.out.println("ok");
        File file = this.getFile().getFile();
        String url = UploadService.uploadImg(file);
        FileKit.delete(file);
        this.renderText(url);
    }

    /**
     * 图片旋转
     */
    public void rotate() {

    }

    /**
     * 图片裁剪
     */
    public void crop() {

    }
}
